﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <!-- Resource dictionary entries should be defined here. -->


    <Style x:Key="SliderButtonStyle" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderButtonStyleLeft" TargetType="{x:Type RepeatButton}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="IsTabStop" Value="false"/>
        <Setter Property="Focusable" Value="false"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type RepeatButton}">
                    <Border Background="Transparent">
                        <Border Background="{TemplateBinding Foreground}" Height="4" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SliderThumbStyle" TargetType="{x:Type Thumb}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Setter Property="Height" Value="14"/>
        <Setter Property="Width" Value="6"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Thumb}">
                    <Border 
                      Name="Thumb" 
                      Background="{TemplateBinding Foreground}"
		              BorderBrush="{TemplateBinding BorderBrush}"
		              BorderThickness="0,0,1,0" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <ControlTemplate x:Key="HorizontalSlider" TargetType="{x:Type Slider}">
        <Grid Height="14">
            <Border Name="TrackBackground" Margin="0" Height="6" Grid.Row="1" Background="{DynamicResource MetroHeadingColorLight}" BorderThickness="1" BorderBrush="{DynamicResource MetroScollbarBg}" />
            <Track Name="PART_Track">
                <Track.DecreaseRepeatButton>
                    <RepeatButton Name="SliderLeft"
                      Foreground="{DynamicResource MetroSliderThumb}"
                      Style="{StaticResource SliderButtonStyleLeft}"
                      Command="Slider.DecreaseLarge" />
                </Track.DecreaseRepeatButton>
                <Track.Thumb>
                    <Thumb Name="SliderThumb" Foreground="{DynamicResource MetroAccentBrush}" Style="{StaticResource SliderThumbStyle}" Margin="0" Height="18" />
                </Track.Thumb>
                <Track.IncreaseRepeatButton>
                    <RepeatButton 
                      Style="{StaticResource SliderButtonStyle}"
                      Command="Slider.IncreaseLarge" />
                </Track.IncreaseRepeatButton>
            </Track>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualStateGroup.Transitions>
                        <VisualTransition To="Normal" GeneratedDuration="0:0:0.1"/>
                    </VisualStateGroup.Transitions>
                    <VisualState x:Name="Normal" />
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ColorAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground.Color" Storyboard.TargetName="SliderLeft">
                                <EasingColorKeyFrame KeyTime="0:0:0.1" Value="{DynamicResource MetroSliderThumbHover}"/>
                            </ColorAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
        </Grid>
        <ControlTemplate.Triggers>
            <Trigger Property="IsEnabled" Value="False">
                <Setter Property="Opacity" Value="0.5"/>
            </Trigger>
        </ControlTemplate.Triggers>
    </ControlTemplate>

    <Style TargetType="{x:Type Slider}">
        <Setter Property="OverridesDefaultStyle" Value="true"/>
        <Style.Triggers>
            <Trigger Property="Orientation" Value="Horizontal">
                <Setter Property="Height" Value="14"/>
                <Setter Property="Template" Value="{StaticResource HorizontalSlider}" />
            </Trigger>
        </Style.Triggers>
    </Style>


</ResourceDictionary>